<script>
	import {doLogin} from "@/api/api"
	export default {
		globalData:{
			scene:0,
			show_ad:true,
			net_ad:false,
			recommend_xcx:[],
			xcx_ad:{
			   video:"adunit-70eb7971ba1f33d5",
			   chaping:"adunit-008ae298d108715d",
			   jili:"adunit-767dab8cb6669cb7",
			   yuansheng:"adunit-8fbd91de70adfe9e",
			   banner:"adunit-61bf9ff468c2152f"
			}
		},
		onLaunch: function(a) {
			const scene = a.scene
			this.globalData.scene = scene
			
			
			
			if(!uni.getStorageSync('is_login')){
				uni.login({
					success: (e) => {
						const code = e.code
						console.log(code)
						doLogin(code).then(res=>{
							if(res.code==0){
								uni.setStorageSync('token',res.data.token)
								uni.setStorageSync('userinfo',res.data.userinfo)
								uni.setStorageSync('user_id',res.data.userinfo.id)
								uni.setStorageSync('is_login',true)
								const query  = a.query
								var newquery = ''
								for(let i in query){
									newquery +=  i +'=' + query[i] + '&'
								}
								//首次进来刷新当前页面，回去opnid
								uni.reLaunch({
									url:'/'+a.path+'?'+newquery
								})
							}else{
								//网络连接出错
							}
							console.log(res)
						})
					}
				})
			}else{
				const query1  = a.query
				for(let i in query1){
					if(i=='fappid'){
						uni.setStorageSync('fappid',query1[i])
					}
				}
			}
			
		},
		onShow: function(a) {
			
		},
		onHide: function() {
			
		}
	}
</script>


<style lang="scss">
	/*每个页面公共css */
	@import "@/uni_modules/uview-ui/index.scss";
	@import "common/demo.scss";
	.mt580{margin-top: 550rpx!important;}
	.ml10{margin-left: 10rpx;}
	.ml15{margin-left: 15rpx;}
	.ml20{margin-left: 20rpx;}
	
	.mr10{margin-right: 10rpx;}
	.mr15{margin-right: 15rpx;}
	.mr20{margin-right: 20rpx;}
	
	.mt10{margin-top: 10rpx;}
	.mt20{margin-top: 20rpx;}
	.mt30{margin-top: 30rpx;}
	
	
	.mb30{margin-bottom: 30rpx;}
	.mb10{margin-bottom: 10rpx;}
	.mb20{margin-bottom: 20rpx;}
	
	
	.mg10_15{margin: 10rpx 15rpx}
	.mg10_30{margin: 10rpx 30rpx}
	.mg30_20{margin: 30rpx 20rpx}
	.mg10{margin: 10rpx;}
	
	.pd10_15{padding: 10rpx 15rpx}
	.p5{padding: 5rpx;}
	.p10{padding: 10rpx;}
	.pdt10{padding-top: 10rpx;}
	.pdt20{padding-top: 20rpx;}
	.pdt30{padding-top: 30rpx;}
	.pd30{padding: 30rpx;}
	.pd0_10{padding: 0 10rpx;}
	.pd0_20{padding: 0 20rpx;}
	.pd20_0{padding: 20rpx 0;}
	.pdb30{padding-bottom: 30rpx;}
	.pdr20{padding-right: 20rpx;}
	
	.mg120{height: 70rpx; line-height: 70rpx; background-color: #05A805; color: #FFFFFF;width: 500rpx;text-align: center;border-radius: 10rpx;display: block!important;}
	.col_999{color: #999999;}
	.col_fff{color: #FFFFFF;}
	
	
	.w100{width: 100%;}
	.w50{width: 50%;}
	.w120{width: 120rpx;}
	.w300{width: 300rpx;}
	.w550{width: 550rpx;}
	.w150{width: 150rpx;}
	.w710{width: 710rpx;}
	.w370{width: 370rpx;}
	.w450{width: 450rpx;}
	.h120{height: 120rpx;}
	.h95{height: 95rpx;}
	.h110{height: 110rpx;}
	.h170{height: 170rpx;}
	.h150{height: 150rpx;}
	.h100{height: 100rpx;}
	.h1000{height: 100%;}
	.h200{height: 200rpx;}
	.h350{height: 350rpx;}
	.txt_c{text-align: center;}
	.txt_l{text-align: left;}
	.txt_r{text-align: right;}
	.fz25{font-size: 25rpx;}
	.fz30{font-size: 30rpx;}
	.fz40{font-size: 40rpx;}
	.flex_wrap{flex-wrap: wrap;}
	.flex_wrap_nowrap{flex-wrap: nowrap;}
	.flex{display: flex;}
	.flex_list{flex: 1;}
	.flex_ac{align-items: center;}
	.flex_as{align-items: flex-start;}
	.flex_ae{align-items: flex-end;}
	.flex_jc{justify-content: center;}
	.flex_jl{justify-content: flex-start;}
	.flex_jr{justify-content: flex-end;}
	.flex_js2{justify-content: space-between;}
	.flex_jsb{justify-content: space-between;}
	.flex_jsa{justify-content: space-around;}
	.flex_vc{justify-content: center;}
	.flex_vl{justify-content: flex-start;}
	.flex_vr{justify-content: flex-end;}
	.flex_hc{align-items: center;}
	.flex_ht{align-items: flex-start;}
	.flex_hd{align-items: flex-end;}
	
	.hidden{overflow: hidden;}
	.hidden1{overflow: hidden;text-overflow: ellipsis;display: -webkit-box;-webkit-line-clamp: 1;-webkit-box-orient: vertical}
	.hidden2{overflow: hidden;text-overflow: ellipsis;display: -webkit-box;-webkit-line-clamp: 2;-webkit-box-orient: vertical}
	.hidden3{overflow: hidden;text-overflow: ellipsis;display: -webkit-box;-webkit-line-clamp: 3;-webkit-box-orient: vertical}
	.hidden4{overflow: hidden;text-overflow: ellipsis;display: -webkit-box;-webkit-line-clamp: 4;-webkit-box-orient: vertical}
	.borr20{border-radius: 20rpx;}
	
	.prel{position: relative;}
	.pab{position: absolute;}
	.t0{top: 0;}
	.l0{left: 0;}
	.c1001 .ttop{display:block!important;}
	.c1002 .boxs{display:block!important;}
	//detail
	.c1001 .ct{display:block!important;}
	.c1002 .article{display:block!important;}
	.pagge .article,.pagge .ct,.pagge .ttop,.pagge .single,.pagge .glist,.pagge .boxs,.pagge .boxs2{display: none;}
	
	
	.backzhezhao{width: 100%;height: 100%;border-radius: 100%;background-color: #000000;
		opacity: .5;position: absolute;top: 0;}
	.back{width: 60rpx;height: 60rpx;position: fixed;top: 38px;left: 24px;z-index: 99999;}
	.back image{width: 100%;height: 100%;z-index: 3;position: relative;}
	
	.caidan .v .t{font-size: 25rpx;color: #FFFFFF;}
	.caidan .v image{width: 60rpx;height: 60rpx;}
	.caidan .v{width: 200rpx;height: 100rpx;background: bottom;}
	.caidan .b2{width: 100%;height: 100%;position: absolute;top: 0;left: 0;background-color: rgba(0, 0, 0, 0.35)}
	.caidan .b1{width: 100%;height: 100%;position: absolute;top: 0;left: 0;justify-content: space-around;}
	.caidan{width: 650rpx;height: 100rpx;position: relative;border-radius: 20rpx;overflow: hidden;}
	.indicator-text{padding: 7rpx 15rpx;background-color: #000000;color: #FFFFFF;font-size: 25rpx;border-radius: 10rpx;}
	.caidanbox{position: fixed;bottom: -100rpx;}
	.caidanboxclose{bottom: -100rpx;animation: caidanclose 1s;}
	.caidanboxopen{bottom: 100rpx;animation: caidanopen 1s;}	
	
	@keyframes caidanopen {
	  0% {
	      bottom: -100rpx;
	  }
	  100% {
	      bottom: 100rpx
	  }
	}
	
	@keyframes caidanclose {
	  0% {
	      bottom: 100rpx;
	  }
	  100% {
	      bottom: -100rpx
	  }
	}
	
	
	.setting_box{justify-content: space-between;width: 650rpx;}
	.setting_btn image{width: 100rpx;}
	.pop_window .li{padding: 20rpx;background-color: #f5f5f5;border-radius: 20rpx;}
	.pop_window .icon{width: 60rpx;}
	.pop_window .right{width: 50%;justify-content: flex-end;}
	.pop_window .left{width: 50%;}
	.pop_window .li_box{margin-bottom: 30rpx;}
	.pop_window{width: 100%;background-color: #ffffff;}
	
	
	.bnli .name{color: #b3b3b3!important;}
	.bnli{filter: grayscale(100%);}
	.bottom-nav .name{font-size: 30rpx;color: #ffffff;}
	.bottom-nav image{width: 60rpx;}
	.bottom-nav{width: 100%;height: 120rpx;position: fixed;bottom: 0;left: 0;border-top: 1px solid #494a4b;box-shadow: 0 2px 6px 0}
	
	.btn-click {transform: scale(0.9,0.9)!important;transition: all 0.1s;}
	
</style>
